package cmcc.dbi.execEnum;

public enum DbTypeOfDriverEnum {

    MySQL("MySQL", "com.mysql.cj.jdbc.Driver"),
    PanweiDB("PanweiDB", "org.panweidb.Driver"),
    PostgreSQL("PostgreSQL", "org.postgresql.Driver"),
    KingBase("KingBase","com.kingbase8.Driver"),
    AntDB("AntDB", "org.postgresql.Driver"),
    GoldenDB("GoldenDB", "com.goldendb.jdbc.Driver"),
    GreatDB("GreatDB", "com.mysql.cj.jdbc.Driver"),
    Oracle("Oracle", "oracle.jdbc.driver.OracleDriver"),
    OceanBase("OceanBase", "com.mysql.cj.jdbc.Driver");

    private String dbType;
    private String dbDriver;

    public String getDbType() {
        return dbType;
    }

    public String getDbDriver() {
        return dbDriver;
    }

    DbTypeOfDriverEnum(String dbType, String dbDriver) {
        this.dbType = dbType;
        this.dbDriver = dbDriver;
    }

    public static DbTypeOfDriverEnum match(String type) {

        DbTypeOfDriverEnum result = null;

        for (DbTypeOfDriverEnum s : DbTypeOfDriverEnum.values()) {
            if (s.getDbType().equalsIgnoreCase(type)) {
                result = s;
                break;
            }
        }

        return result;
    }


}
